let picture = document.querySelector('#avatar')
let qq = document.querySelector('#qqNumber')
let psd = document.querySelector('#password')
let login = document.querySelector('#submit')
// qq头像获取
qq.addEventListener('blur', () => {
  // 不为空则替换src
  if (qq.value!= '') {
    let xhr = new XMLHttpRequest()
    xhr.open('get', `https://api.uomg.com/api/qq.info?qq=${qq.value}`)
    xhr.onreadystatechange = function () {
      if (xhr.readyState == 4 && xhr.status == 200) {
        var data = JSON.parse(xhr.responseText)
        if (data.qlogo != undefined) {
          picture.src = data.qlogo
        } else {
          picture.src = `./image/picture.png`
        }
      }
    }
    xhr.send(null)
  } else {
    picture.src = `./image/picture.png`
  }
})
